<!--
 * @Description: 流程头部操作按钮
 * @Author: wangwangwang
 * @Date: 2020-12-21 09:55:05
 * @LastEditors: wangwangwang
 * @LastEditTime: 2021-03-22 11:19:10
-->
<template>
  <el-header style="margin-bottom: 20px;">
    <div class="handle-container">
      <el-row type="flex" align="middle">
        <el-col>
          <el-button :disabled="isReadOnly" size="medium" class="bottom_all" style="margin-left: 0;" @click="saveSubmit()">保存</el-button>
          <el-button :disabled="isReadOnly" size="medium" class="bottom_all_two" @click="sendSubmit()">提交</el-button>
          <el-button v-if="hasBackPermiss" :disabled="!isReadOnly" size="medium" class="bottom_three" style="margin-left: 24px;" @click="handleBackEnd">撤销</el-button>
        </el-col>
        <el-col v-if="!isinit&&!isReadOnly2" style="text-align:right;">
          <el-button size="mini" icon="el-icon-position" type="text" class="bottom_text" @click="handleCC">抄送</el-button>
          <el-button :disabled="isReadOnly" size="mini" icon="el-icon-tickets" type="text" class="bottom_text" @click="handleAssign">交办</el-button>
          <el-button :disabled="isReadOnly" size="mini" icon="el-icon-d-arrow-right" type="text" class="bottom_text" @click="handleBackUp">回退</el-button>
          <el-button :disabled="isReadOnly" size="mini" icon="el-icon-document" type="text" class="bottom_text" @click="handleAssist">协审</el-button>
          <el-button :disabled="isReadOnly" size="mini" icon="el-icon-collection-tag" type="text" class="bottom_text" @click="handleNode">加减签</el-button>
          <el-button size="mini" icon="el-icon-set-up" type="text" class="bottom_text" @click="handleNodeImage">流程图</el-button>
          <el-button size="mini" icon="el-icon-star-off" type="text" class="bottom_text" @click="handleCollection">收藏任务</el-button>
        </el-col>
      </el-row>
    </div>
  </el-header>
</template>
<script>
export default {
  props: ['isReadOnly2'],
  data() {
    return {
      hasBackPermiss: false,
      isReadOnly: false,
      isinit: false,
    }
  },
  methods: {
    saveSubmit() {
      this.$emit('saveSubmit');
    },
    sendSubmit() {
      this.$emit('sendSubmit');
    },
    handleBackEnd() {
      this.$emit('handleBackEnd');
    },
    handleCC() {
      this.$emit('handleCC');
    },
    handleAssign() {
      this.$emit('handleAssign');
    },
    handleBackUp() {
      this.$emit('handleBackUp');
    },
    handleAssist() {
      this.$emit('handleAssist');
    },
    handleNode() {
      this.$emit('handleNode');
    },
    handleNodeImage() {
      this.$emit('handleNodeImage');
    },
    handleCollection() {
      this.$emit('handleCollection');
    },
  },
  mounted() {
    const { query } = this.$route;
    this.isinit = query.type * 1 === 1 || !query.type;
    console.log(this.isinit)
    console.log(this.isReadOnly2)
    this.isReadOnly = query.isReadOnly*1===1;
  }
}
</script>
<style scoped lang="scss">
.handle-container {
  border-radius: 4px;
  background: #fff;
  width: 100%;
}
</style>

